
var query = args.query;

var results = search.luceneSearch("+PATH:\"/app:company_home/st:sites//*\" +TYPE:\"cm\:folder\" +@cm\\:name:\"*" + query + "*\"");

//add path to name except the first x path elements
var newResults = new Array();
for (var i = 0; i < results.length; i++) {
	var pathElements = (results[i].displayPath).split("/");
	var newPath = pathElements.splice(4, pathElements.length);
	var nodo = new MioNodo(results[i].name,newPath.join("/"),results[i].nodeRef.toString());
	newResults[i] = nodo;
}

function MioNodo(Nome,Path,NodeRef) {
	this.Nome = Nome;
	this.Path = Path;
	this.NodeRef = NodeRef;
}

model.results = newResults;